<%@ page language="java" pageEncoding="UTF-8"%>
<script type="text/javascript">
	var studentResumeDatagrid;
	var studentVehicleDatagrid;
	var studentRelationshipDatagrid;
	var studentFamilyDatagrid;
	var studentEducationDatagrid;
	var studentTrainingDatagrid;
	$(function() {
		studentResumeDatagrid = $('#student_studentEdit_resumeDatagrid').datagrid({
			url : '${pageContext.request.contextPath}/resumeAction!queryResume.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10 ],
			checkOnSelect : true,
			selectOnCheck : true,
			singleSelect : true,
			striped : true,
			columns : [ [ {
				field : 'id',
				title : '编号',
				width : 80,
				checkbox : true
			}, {
				field : 'corporationName',
				title : '单位',
				width : 150,
				align : 'left',
				sortable : true
			}, {
				field : 'region',
				title : '地区',
				width : 120,
				align : 'left'
			}, {
				field : 'position',
				title : '职务',
				width : 100,
				align : 'left'
			}, {
				field : 'headFlag',
				title : '是否负责人',
				width : 50,
				align : 'center',
				hidden : true
			}, {
				field : 'headFlagName',
				title : '是否负责人',
				width : 80,
				align : 'center'
			}, {
				field : 'startDate',
				title : '开始日期',
				width : 80,
				hidden : true
			}, {
				field : 'startDateStr',
				title : '开始日期',
				width : 80,
				align : 'center'
			}, {
				field : 'endDate',
				title : '截止日期',
				width : 80,
				hidden : true
			}, {
				field : 'endDateStr',
				title : '截止日期',
				width : 80,
				align : 'center'
			} ] ],
			toolbar : [ {
				text : '增加',
				iconCls : 'icon-add',
				handler : function() {
					addResume();
				}
			}, '-', {
				text : '修改',
				iconCls : 'icon-edit',
				handler : function() {
					editResume();
				}
			}, '-', {
				text : '删除',
				iconCls : 'icon-remove',
				handler : function() {
					removeResume();
				}
			} ]
		});

		studentVehicleDatagrid = $('#student_studentEdit_vehicleDatagrid').datagrid({
			url : '${pageContext.request.contextPath}/vehicleAction!queryVehicle.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10 ],
			checkOnSelect : true,
			selectOnCheck : true,
			singleSelect : true,
			striped : true,
			columns : [ [ {
				field : 'id',
				title : '编号',
				width : 80,
				checkbox : true
			}, {
				field : 'brand',
				title : '品牌',
				width : 100,
				align : 'left',
				sortable : true
			}, {
				field : 'model',
				title : '型号',
				width : 100,
				align : 'left'
			}, {
				field : 'plateNo',
				title : '车牌号码',
				width : 100,
				align : 'left'
			}, {
				field : 'memo',
				title : '备注',
				width : 150,
				align : 'left'
			} ] ],
			toolbar : [ {
				text : '增加',
				iconCls : 'icon-add',
				handler : function() {
					addVehicle();
				}
			}, '-', {
				text : '修改',
				iconCls : 'icon-edit',
				handler : function() {
					editVehicle();
				}
			}, '-', {
				text : '删除',
				iconCls : 'icon-remove',
				handler : function() {
					removeVehicle();
				}
			} ]
		});

		studentRelationshipDatagrid = $('#student_studentEdit_relationshipDatagrid').datagrid({
			url : '${pageContext.request.contextPath}/relationshipAction!queryRelationship.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10 ],
			checkOnSelect : true,
			selectOnCheck : true,
			singleSelect : true,
			striped : true,
			columns : [ [ {
				field : 'id',
				title : '编号',
				width : 80,
				checkbox : true
			}, {
				field : 'name',
				title : '姓名',
				width : 80,
				align : 'left',
				sortable : true
			}, {
				field : 'relationship',
				title : '关系',
				width : 80,
				hidden : true
			}, {
				field : 'relationshipName',
				title : '关系',
				width : 80,
				align : 'center'
			}, {
				field : 'corporationName',
				title : '单位',
				width : 150,
				align : 'left'
			}, {
				field : 'phone',
				title : '联系电话',
				width : 80,
				align : 'left'
			}, {
				field : 'qq',
				title : 'QQ',
				width : 80,
				align : 'left'
			}, {
				field : 'email',
				title : '电子邮件',
				width : 100,
				align : 'left'
			}, {
				field : 'memo',
				title : '备注',
				width : 150,
				align : 'left'
			} ] ],
			toolbar : [ {
				text : '增加',
				iconCls : 'icon-add',
				handler : function() {
					addRelationship();
				}
			}, '-', {
				text : '修改',
				iconCls : 'icon-edit',
				handler : function() {
					editRelationship();
				}
			}, '-', {
				text : '删除',
				iconCls : 'icon-remove',
				handler : function() {
					removeRelationship();
				}
			} ]
		});

		studentFamilyDatagrid = $('#student_studentEdit_familyDatagrid').datagrid({
			url : '${pageContext.request.contextPath}/familyAction!queryFamily.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10 ],
			checkOnSelect : true,
			selectOnCheck : true,
			singleSelect : true,
			striped : true,
			columns : [ [ {
				field : 'id',
				title : '编号',
				width : 80,
				checkbox : true
			}, {
				field : 'name',
				title : '姓名',
				width : 80,
				align : 'left',
				sortable : true
			}, {
				field : 'relationship',
				title : '关系',
				width : 80,
				hidden : true
			}, {
				field : 'relationshipName',
				title : '关系',
				width : 80,
				align : 'center'
			}, {
				field : 'gender',
				title : '性别',
				width : 80,
				hidden : true
			}, {
				field : 'genderName',
				title : '性别',
				width : 80,
				align : 'center'
			}, {
				field : 'birthday',
				title : '出生日期',
				width : 80,
				hidden : true
			}, {
				field : 'birthdayStr',
				title : '出生日期',
				width : 100,
				align : 'left'
			}, {
				field : 'belief',
				title : '宗教信仰',
				width : 80,
				hidden : true
			}, {
				field : 'beliefName',
				title : '宗教信仰',
				width : 80,
				align : 'left'
			}, {
				field : 'health',
				title : '健康状况',
				width : 100,
				align : 'left'
			}, {
				field : 'memo',
				title : '备注',
				width : 150,
				align : 'left'
			} ] ],
			toolbar : [ {
				text : '增加',
				iconCls : 'icon-add',
				handler : function() {
					addFamily();
				}
			}, '-', {
				text : '修改',
				iconCls : 'icon-edit',
				handler : function() {
					editFamily();
				}
			}, '-', {
				text : '删除',
				iconCls : 'icon-remove',
				handler : function() {
					removeFamily();
				}
			} ]
		});

		studentEducationDatagrid = $('#student_studentEdit_educationDatagrid').datagrid({
			url : '${pageContext.request.contextPath}/educationAction!queryEducation.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10 ],
			checkOnSelect : true,
			selectOnCheck : true,
			singleSelect : true,
			striped : true,
			columns : [ [ {
				field : 'id',
				title : '编号',
				width : 60,
				checkbox : true
			}, {
				field : 'phaseName',
				title : '阶段名称',
				width : 80,
				sortable : true
			}, {
				field : 'school',
				title : '就读学校',
				width : 150,
				align : 'left'
			}, {
				field : 'startDate',
				title : '开始日期',
				width : 80,
				hidden : true
			}, {
				field : 'startDateStr',
				title : '开始日期',
				width : 80,
				align : 'left'
			}, {
				field : 'endDate',
				title : '截止日期',
				width : 80,
				hidden : true
			}, {
				field : 'endDateStr',
				title : '截止日期',
				width : 80,
				align : 'left'
			}, {
				field : 'education',
				title : '学历',
				width : 60,
				hidden : true
			}, {
				field : 'educationName',
				title : '学历',
				width : 60,
				align : 'left'
			}, {
				field : 'degree',
				title : '学位',
				width : 60,
				hidden : true
			}, {
				field : 'degreeName',
				title : '学位',
				width : 60,
				align : 'left'
			}, {
				field : 'memo',
				title : '备注',
				width : 100,
				align : 'left'
			} ] ],
			toolbar : [ {
				text : '增加',
				iconCls : 'icon-add',
				handler : function() {
					addEducation();
				}
			}, '-', {
				text : '修改',
				iconCls : 'icon-edit',
				handler : function() {
					editEducation();
				}
			}, '-', {
				text : '删除',
				iconCls : 'icon-remove',
				handler : function() {
					removeEducation();
				}
			} ]
		});

		studentTrainingDatagrid = $('#student_studentEdit_trainingDatagrid').datagrid({
			url : '${pageContext.request.contextPath}/trainingAction!queryTraining.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10 ],
			checkOnSelect : true,
			selectOnCheck : true,
			singleSelect : true,
			striped : true,
			columns : [ [ {
				field : 'id',
				title : '编号',
				width : 60,
				checkbox : true
			}, {
				field : 'trainingName',
				title : '培训名称',
				width : 100,
				align : 'left',
				sortable : true
			}, {
				field : 'trainingSchool',
				title : '培训学校',
				width : 150,
				align : 'left'
			}, {
				field : 'startDate',
				title : '开始日期',
				width : 80,
				hidden : true
			}, {
				field : 'startDateStr',
				title : '开始日期',
				width : 80,
				align : 'left'
			}, {
				field : 'endDate',
				title : '截止日期',
				width : 80,
				hidden : true
			}, {
				field : 'endDateStr',
				title : '截止日期',
				width : 80,
				align : 'left'
			}, {
				field : 'certificateName',
				title : '证书名称',
				width : 100,
				align : 'left'
			}, {
				field : 'memo',
				title : '备注',
				width : 100,
				align : 'left'
			} ] ],
			toolbar : [ {
				text : '增加',
				iconCls : 'icon-add',
				handler : function() {
					addTraining();
				}
			}, '-', {
				text : '修改',
				iconCls : 'icon-edit',
				handler : function() {
					editTraining();
				}
			}, '-', {
				text : '删除',
				iconCls : 'icon-remove',
				handler : function() {
					removeTraining();
				}
			} ]
		});

		$('.datagrid-header div').css({
			'textAlign' : 'center'
		});

		function addTraining() {
			$('#student_trainingAdd_addTrainingForm input').val('');
			var dlg = $('<div style="padding:10px 20px;" />').dialog({
				width : 550,
				height : 270,
				href : '${pageContext.request.contextPath}/pages/student/trainingAdd.jsp',
				modal : true,
				title : '培训信息新增',
				buttons : [ {
					text : '保存',
					handler : function() {
						$('#student_trainingAdd_addTrainingForm').form('submit', {
							url : '${pageContext.request.contextPath}/trainingAction!addTraining.action',
							success : function(r) {
								var obj = jQuery.parseJSON(r);
								if (obj.success) {
									studentTrainingDatagrid.datagrid('insertRow', {
										index : 0,
										row : obj.obj
									});
									dlg.dialog('close');
									$.messager.show({
										title : '提示',
										msg : obj.msg
									});
								} else {
									$.messager.alert('提示', obj.msg);
								}
							}
						});
					}
				}, {
					text : '取消',
					handler : function() {
						$('#student_trainingAdd_addTrainingForm input').val('');
						dlg.dialog('close');
					}
				} ],
				onClose : function() {
					$(this).dialog('destroy');
				},
				onLoad : function() {
					$('#student_trainingAdd_addTrainingForm input[name=studentId]').val(studentId);
				}
			});
		}

		function editTraining() {
			var rows = studentTrainingDatagrid.datagrid('getChecked');
			if (rows.length == 1) {
				var dlg = $('<div style="padding:10px 20px;" />').dialog({
					width : 550,
					height : 270,
					href : '${pageContext.request.contextPath}/pages/student/trainingEdit.jsp',
					modal : true,
					title : '家庭信息编辑',
					buttons : [ {
						text : '保存',
						handler : function() {
							$('#student_trainingEdit_editTrainingForm').form('submit', {
								url : '${pageContext.request.contextPath}/trainingAction!editTraining.action',
								success : function(r) {
									var obj = jQuery.parseJSON(r);
									if (obj.success) {
										studentTrainingDatagrid.datagrid('updateRow', {
											index : studentTrainingDatagrid.datagrid('getRowIndex', rows[0].id),
											row : obj.obj
										});
										dlg.dialog('close');
										$.messager.show({
											title : '提示',
											msg : obj.msg
										});
									} else {
										$.messager.alert('提示', obj.msg);
									}
								}
							});
						}
					}, {
						text : '取消',
						handler : function() {
							dlg.dialog('close');
						}
					} ],
					onClose : function() {
						$(this).dialog('destroy');
					},
					onLoad : function() {
						if (rows[0].startDate != null && trim(rows[0].startDate) != "") {
							if (rows[0].startDate.length > 10) {
								var t = rows[0].startDate.substring(0, 10);
								rows[0].startDate = t;
							}
						}
						if (rows[0].endDate != null && trim(rows[0].endDate) != "") {
							if (rows[0].endDate.length > 10) {
								var t = rows[0].endDate.substring(0, 10);
								rows[0].endDate = t;
							}
						}
						$('#student_trainingEdit_editTrainingForm').form('load', rows[0]);
						$('#student_trainingEdit_editTrainingForm input[name=id]').val(rows[0].id);
					}
				});
			} else {
				$.messager.alert('提示', '一次只能修改一条数据！');
			}
		}

		function removeTraining() {
			var rows = studentTrainingDatagrid.datagrid('getChecked');
			var ids = [];
			if (rows.length > 0) {
				$.messager.confirm('确认', '确定要删除选择的数据吗？', function(r) {
					if (r) {
						for ( var i = 0; i < rows.length; i++) {
							ids.push(rows[i].id);
						}
						$.ajax({
							url : '${pageContext.request.contextPath}/trainingAction!removeTraining.action',
							data : {
								ids : ids.join(',')
							},
							dataType : 'json',
							success : function(r) {
								studentTrainingDatagrid.datagrid('load');
								studentTrainingDatagrid.datagrid('unselectAll');
								$.messager.show({
									title : '提示',
									msg : r.msg,
								});
							}
						});
					}
				});
			} else {
				$.messager.show({
					title : '提示',
					msg : '请勾选要删除的记录！'
				});
			}
		}

		function addEducation() {
			$('#student_educationAdd_addEducationForm input').val('');
			var dlg = $('<div style="padding:10px 20px;" />').dialog({
				width : 550,
				height : 280,
				href : '${pageContext.request.contextPath}/pages/student/educationAdd.jsp',
				modal : true,
				title : '教育信息新增',
				buttons : [ {
					text : '保存',
					handler : function() {
						$('#student_educationAdd_addEducationForm').form('submit', {
							url : '${pageContext.request.contextPath}/educationAction!addEducation.action',
							success : function(r) {
								var obj = jQuery.parseJSON(r);
								if (obj.success) {
									studentEducationDatagrid.datagrid('insertRow', {
										index : 0,
										row : obj.obj
									});
									dlg.dialog('close');
									$.messager.show({
										title : '提示',
										msg : obj.msg
									});
								} else {
									$.messager.alert('提示', obj.msg);
								}
							}
						});
					}
				}, {
					text : '取消',
					handler : function() {
						$('#student_educationAdd_addEducationForm input').val('');
						dlg.dialog('close');
					}
				} ],
				onClose : function() {
					$(this).dialog('destroy');
				},
				onLoad : function() {
					$('#student_educationAdd_addEducationForm input[name=studentId]').val(studentId);
					$('#student_educationAdd_educationCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '12');
					$('#student_educationAdd_educationCombobox').combobox('select', '00');
					$('#student_educationAdd_degreeCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '13');
					$('#student_educationAdd_degreeCombobox').combobox('select', '00');
				}
			});
		}

		function editEducation() {
			var rows = studentEducationDatagrid.datagrid('getChecked');
			if (rows.length == 1) {
				var dlg = $('<div style="padding:10px 20px;" />').dialog({
					width : 550,
					height : 280,
					href : '${pageContext.request.contextPath}/pages/student/educationEdit.jsp',
					modal : true,
					title : '家庭信息编辑',
					buttons : [ {
						text : '保存',
						handler : function() {
							$('#student_educationEdit_editEducationForm').form('submit', {
								url : '${pageContext.request.contextPath}/educationAction!editEducation.action',
								success : function(r) {
									var obj = jQuery.parseJSON(r);
									if (obj.success) {
										studentEducationDatagrid.datagrid('updateRow', {
											index : studentEducationDatagrid.datagrid('getRowIndex', rows[0].id),
											row : obj.obj
										});
										dlg.dialog('close');
										$.messager.show({
											title : '提示',
											msg : obj.msg
										});
									} else {
										$.messager.alert('提示', obj.msg);
									}
								}
							});
						}
					}, {
						text : '取消',
						handler : function() {
							dlg.dialog('close');
						}
					} ],
					onClose : function() {
						$(this).dialog('destroy');
					},
					onLoad : function() {
						if (rows[0].startDate != null && trim(rows[0].startDate) != "") {
							if (rows[0].startDate.length > 10) {
								var t = rows[0].startDate.substring(0, 10);
								rows[0].startDate = t;
							}
						}
						if (rows[0].endDate != null && trim(rows[0].endDate) != "") {
							if (rows[0].endDate.length > 10) {
								var t = rows[0].endDate.substring(0, 10);
								rows[0].endDate = t;
							}
						}
						$('#student_educationEdit_editEducationForm').form('load', rows[0]);
						$('#student_educationEdit_editEducationForm input[name=id]').val(rows[0].id);
						$('#student_educationEdit_educationCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '12');
						$('#student_educationEdit_educationCombobox').combobox('select', rows[0].education);
						$('#student_educationEdit_degreeCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '13');
						$('#student_educationEdit_degreeCombobox').combobox('select', rows[0].degree);
					}
				});
			} else {
				$.messager.alert('提示', '一次只能修改一条数据！');
			}
		}

		function removeEducation() {
			var rows = studentEducationDatagrid.datagrid('getChecked');
			var ids = [];
			if (rows.length > 0) {
				$.messager.confirm('确认', '确定要删除选择的数据吗？', function(r) {
					if (r) {
						for ( var i = 0; i < rows.length; i++) {
							ids.push(rows[i].id);
						}
						$.ajax({
							url : '${pageContext.request.contextPath}/educationAction!removeEducation.action',
							data : {
								ids : ids.join(',')
							},
							dataType : 'json',
							success : function(r) {
								studentEducationDatagrid.datagrid('load');
								studentEducationDatagrid.datagrid('unselectAll');
								$.messager.show({
									title : '提示',
									msg : r.msg,
								});
							}
						});
					}
				});
			} else {
				$.messager.show({
					title : '提示',
					msg : '请勾选要删除的记录！'
				});
			}
		}

		function addFamily() {
			$('#student_familyAdd_addFamilyForm input').val('');
			var dlg = $('<div style="padding:10px 20px;" />').dialog({
				width : 550,
				height : 310,
				href : '${pageContext.request.contextPath}/pages/student/familyAdd.jsp',
				modal : true,
				title : '家庭信息新增',
				buttons : [ {
					text : '保存',
					handler : function() {
						$('#student_familyAdd_addFamilyForm').form('submit', {
							url : '${pageContext.request.contextPath}/familyAction!addFamily.action',
							success : function(r) {
								var obj = jQuery.parseJSON(r);
								if (obj.success) {
									studentFamilyDatagrid.datagrid('insertRow', {
										index : 0,
										row : obj.obj
									});
									dlg.dialog('close');
									$.messager.show({
										title : '提示',
										msg : obj.msg
									});
								} else {
									$.messager.alert('提示', obj.msg);
								}
							}
						});
					}
				}, {
					text : '取消',
					handler : function() {
						$('#student_familyAdd_addFamilyForm input').val('');
						dlg.dialog('close');
					}
				} ],
				onClose : function() {
					$(this).dialog('destroy');
				},
				onLoad : function() {
					$('#student_familyAdd_addFamilyForm input[name=studentId]').val(studentId);
					$('#student_familyAdd_relationshipCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '10');
					$('#student_familyAdd_beliefCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '11');
				}
			});
		}

		function editFamily() {
			var rows = studentFamilyDatagrid.datagrid('getChecked');
			if (rows.length == 1) {
				var dlg = $('<div style="padding:10px 20px;" />').dialog({
					width : 550,
					height : 310,
					href : '${pageContext.request.contextPath}/pages/student/familyEdit.jsp',
					modal : true,
					title : '家庭信息编辑',
					buttons : [ {
						text : '保存',
						handler : function() {
							$('#student_familyEdit_editFamilyForm').form('submit', {
								url : '${pageContext.request.contextPath}/familyAction!editFamily.action',
								success : function(r) {
									var obj = jQuery.parseJSON(r);
									if (obj.success) {
										studentFamilyDatagrid.datagrid('updateRow', {
											index : studentFamilyDatagrid.datagrid('getRowIndex', rows[0].id),
											row : obj.obj
										});
										dlg.dialog('close');
										$.messager.show({
											title : '提示',
											msg : obj.msg
										});
									} else {
										$.messager.alert('提示', obj.msg);
									}
								}
							});
						}
					}, {
						text : '取消',
						handler : function() {
							dlg.dialog('close');
						}
					} ],
					onClose : function() {
						$(this).dialog('destroy');
					},
					onLoad : function() {
						if (rows[0].birthday != null && trim(rows[0].birthday) != "") {
							if (rows[0].birthday.length > 10) {
								var t = rows[0].birthday.substring(0, 10);
								rows[0].birthday = t;
							}
						}
						$('#student_familyEdit_editFamilyForm').form('load', rows[0]);
						$('#student_familyEdit_editFamilyForm input[name=id]').val(rows[0].id);
						$('#student_familyEdit_relationshipCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '10');
						$('#student_familyEdit_relationshipCombobox').combobox('select', rows[0].relationship);
						$('#student_familyEdit_beliefCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '11');
						$('#student_familyEdit_beliefCombobox').combobox('select', rows[0].belief);
					}
				});
			} else {
				$.messager.alert('提示', '一次只能修改一条数据！');
			}
		}

		function removeFamily() {
			var rows = studentFamilyDatagrid.datagrid('getChecked');
			var ids = [];
			if (rows.length > 0) {
				$.messager.confirm('确认', '确定要删除选择的数据吗？', function(r) {
					if (r) {
						for ( var i = 0; i < rows.length; i++) {
							ids.push(rows[i].id);
						}
						$.ajax({
							url : '${pageContext.request.contextPath}/familyAction!removeFamily.action',
							data : {
								ids : ids.join(',')
							},
							dataType : 'json',
							success : function(r) {
								studentFamilyDatagrid.datagrid('load');
								studentFamilyDatagrid.datagrid('unselectAll');
								$.messager.show({
									title : '提示',
									msg : r.msg,
								});
							}
						});
					}
				});
			} else {
				$.messager.show({
					title : '提示',
					msg : '请勾选要删除的记录！'
				});
			}
		}

		function addRelationship() {
			$('#student_relationshipAdd_addRelationshipForm input').val('');
			var dlg = $('<div style="padding:10px 20px;" />').dialog({
				width : 520,
				height : 280,
				href : '${pageContext.request.contextPath}/pages/student/relationshipAdd.jsp',
				modal : true,
				title : '人际关系新增',
				buttons : [ {
					text : '保存',
					handler : function() {
						$('#student_relationshipAdd_addRelationshipForm').form('submit', {
							url : '${pageContext.request.contextPath}/relationshipAction!addRelationship.action',
							success : function(r) {
								var obj = jQuery.parseJSON(r);
								if (obj.success) {
									studentRelationshipDatagrid.datagrid('insertRow', {
										index : 0,
										row : obj.obj
									});
									dlg.dialog('close');
									$.messager.show({
										title : '提示',
										msg : obj.msg
									});
								} else {
									$.messager.alert('提示', obj.msg);
								}
							}
						});
					}
				}, {
					text : '取消',
					handler : function() {
						$('#student_relationshipAdd_addRelationshipForm input').val('');
						dlg.dialog('close');
					}
				} ],
				onClose : function() {
					$(this).dialog('destroy');
				},
				onLoad : function() {
					$('#student_relationshipAdd_addRelationshipForm input[name=studentId]').val(studentId);
					$('#student_relationshipAdd_relationshipCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '09');
				}
			});
		}

		function editRelationship() {
			var rows = studentRelationshipDatagrid.datagrid('getChecked');
			if (rows.length == 1) {
				var dlg = $('<div style="padding:10px 20px;" />').dialog({
					width : 520,
					height : 280,
					href : '${pageContext.request.contextPath}/pages/student/relationshipEdit.jsp',
					modal : true,
					title : '人际关系编辑',
					buttons : [ {
						text : '保存',
						handler : function() {
							$('#student_relationshipEdit_editRelationshipForm').form('submit', {
								url : '${pageContext.request.contextPath}/relationshipAction!editRelationship.action',
								success : function(r) {
									var obj = jQuery.parseJSON(r);
									if (obj.success) {
										studentRelationshipDatagrid.datagrid('updateRow', {
											index : studentRelationshipDatagrid.datagrid('getRowIndex', rows[0].id),
											row : obj.obj
										});
										dlg.dialog('close');
										$.messager.show({
											title : '提示',
											msg : obj.msg
										});
									} else {
										$.messager.alert('提示', obj.msg);
									}
								}
							});
						}
					}, {
						text : '取消',
						handler : function() {
							dlg.dialog('close');
						}
					} ],
					onClose : function() {
						$(this).dialog('destroy');
					},
					onLoad : function() {
						$('#student_relationshipEdit_editRelationshipForm').form('load', rows[0]);
						$('#student_relationshipEdit_editRelationshipForm input[name=id]').val(rows[0].id);
						$('#student_relationshipEdit_relationshipCombobox').combobox('reload', '${pageContext.request.contextPath}/codeAction!queryCodeList.action?ctype=' + '09');
						$('#corporation_corporationEdit_codeCombobox').combobox('select', rows[0].relationship);
					}
				});
			} else {
				$.messager.alert('提示', '一次只能修改一条数据！');
			}
		}

		function removeRelationship() {
			var rows = studentRelationshipDatagrid.datagrid('getChecked');
			var ids = [];
			if (rows.length > 0) {
				$.messager.confirm('确认', '确定要删除选择的数据吗？', function(r) {
					if (r) {
						for ( var i = 0; i < rows.length; i++) {
							ids.push(rows[i].id);
						}
						$.ajax({
							url : '${pageContext.request.contextPath}/relationshipAction!removeRelationship.action',
							data : {
								ids : ids.join(',')
							},
							dataType : 'json',
							success : function(r) {
								studentRelationshipDatagrid.datagrid('load');
								studentRelationshipDatagrid.datagrid('unselectAll');
								$.messager.show({
									title : '提示',
									msg : r.msg,
								});
							}
						});
					}
				});
			} else {
				$.messager.show({
					title : '提示',
					msg : '请勾选要删除的记录！'
				});
			}
		}

		function addVehicle() {
			$('#student_vehicleAdd_addVehicleForm input').val('');
			var dlg = $('<div style="padding:10px 20px;" />').dialog({
				width : 380,
				height : 250,
				href : '${pageContext.request.contextPath}/pages/student/vehicleAdd.jsp',
				modal : true,
				title : '车辆新增',
				buttons : [ {
					text : '保存',
					handler : function() {
						$('#student_vehicleAdd_addVehicleForm').form('submit', {
							url : '${pageContext.request.contextPath}/vehicleAction!addVehicle.action',
							success : function(r) {
								var obj = jQuery.parseJSON(r);
								if (obj.success) {
									studentVehicleDatagrid.datagrid('insertRow', {
										index : 0,
										row : obj.obj
									});
									dlg.dialog('close');
									$.messager.show({
										title : '提示',
										msg : obj.msg
									});
								} else {
									$.messager.alert('提示', obj.msg);
								}
							}
						});
					}
				}, {
					text : '取消',
					handler : function() {
						$('#student_vehicleAdd_addVehicleForm input').val('');
						dlg.dialog('close');
					}
				} ],
				onClose : function() {
					$(this).dialog('destroy');
				},
				onLoad : function() {
					$('#student_vehicleAdd_addVehicleForm input[name=studentId]').val(studentId);
				}
			});
		}

		function editVehicle() {
			var rows = studentVehicleDatagrid.datagrid('getChecked');
			if (rows.length == 1) {
				var dlg = $('<div style="padding:10px 20px;" />').dialog({
					width : 380,
					height : 250,
					href : '${pageContext.request.contextPath}/pages/student/vehicleEdit.jsp',
					modal : true,
					title : '车辆编辑',
					buttons : [ {
						text : '保存',
						handler : function() {
							$('#student_vehicleEdit_editVehicleForm').form('submit', {
								url : '${pageContext.request.contextPath}/vehicleAction!editVehicle.action',
								success : function(r) {
									var obj = jQuery.parseJSON(r);
									if (obj.success) {
										studentVehicleDatagrid.datagrid('updateRow', {
											index : studentVehicleDatagrid.datagrid('getRowIndex', rows[0].id),
											row : obj.obj
										});
										dlg.dialog('close');
										$.messager.show({
											title : '提示',
											msg : obj.msg
										});
									} else {
										$.messager.alert('提示', obj.msg);
									}
								}
							});
						}
					}, {
						text : '取消',
						handler : function() {
							dlg.dialog('close');
						}
					} ],
					onClose : function() {
						$(this).dialog('destroy');
					},
					onLoad : function() {
						$('#student_vehicleEdit_editVehicleForm').form('load', rows[0]);
						$('#student_vehicleEdit_editVehicleForm input[name=id]').val(rows[0].id);
					}
				});
			} else {
				$.messager.alert('提示', '一次只能修改一条数据！');
			}
		}

		function removeVehicle() {
			var rows = studentVehicleDatagrid.datagrid('getChecked');
			var ids = [];
			if (rows.length > 0) {
				$.messager.confirm('确认', '确定要删除选择的数据吗？', function(r) {
					if (r) {
						for ( var i = 0; i < rows.length; i++) {
							ids.push(rows[i].id);
						}
						$.ajax({
							url : '${pageContext.request.contextPath}/vehicleAction!removeVehicle.action',
							data : {
								ids : ids.join(',')
							},
							dataType : 'json',
							success : function(r) {
								studentVehicleDatagrid.datagrid('load');
								studentVehicleDatagrid.datagrid('unselectAll');
								$.messager.show({
									title : '提示',
									msg : r.msg,
								});
							}
						});
					}
				});
			} else {
				$.messager.show({
					title : '提示',
					msg : '请勾选要删除的记录！'
				});
			}
		}

		function addResume() {
			$('#student_resumeAdd_addResumeForm input').val('');
			var dlg = $('<div style="padding:10px 20px;" />').dialog({
				width : 540,
				height : 220,
				href : '${pageContext.request.contextPath}/pages/student/resumeAdd.jsp',
				modal : true,
				title : '职业履历新增',
				buttons : [ {
					text : '保存',
					handler : function() {
						$('#student_resumeAdd_addResumeForm').form('submit', {
							url : '${pageContext.request.contextPath}/resumeAction!addResume.action',
							success : function(r) {
								var obj = jQuery.parseJSON(r);
								if (obj.success) {
									studentResumeDatagrid.datagrid('insertRow', {
										index : 0,
										row : obj.obj
									});
									dlg.dialog('close');
									$.messager.show({
										title : '提示',
										msg : obj.msg
									});
								} else {
									$.messager.alert('提示', obj.msg);
								}
							}
						});
					}
				}, {
					text : '取消',
					handler : function() {
						$('#student_resumeAdd_addResumeForm input').val('');
						dlg.dialog('close');
					}
				} ],
				onClose : function() {
					$(this).dialog('destroy');
				},
				onLoad : function() {
					$('#student_resumeAdd_addResumeForm input[name=studentId]').val(studentId);
				}
			});
		}

		function editResume() {
			var rows = studentResumeDatagrid.datagrid('getChecked');
			if (rows.length == 1) {
				var dlg = $('<div style="padding:10px 20px;" />').dialog({
					width : 540,
					height : 220,
					href : '${pageContext.request.contextPath}/pages/student/resumeEdit.jsp',
					modal : true,
					title : '职业履历编辑',
					buttons : [ {
						text : '保存',
						handler : function() {
							$('#student_studentEdit_editResumeForm').form('submit', {
								url : '${pageContext.request.contextPath}/resumeAction!editResume.action',
								success : function(r) {
									var obj = jQuery.parseJSON(r);
									if (obj.success) {
										$('#student_studentEdit_resumeDatagrid').datagrid('updateRow', {
											index : $('#student_studentEdit_resumeDatagrid').datagrid('getRowIndex', rows[0].id),
											row : obj.obj
										});
										dlg.dialog('close');
										$.messager.show({
											title : '提示',
											msg : obj.msg
										});
									} else {
										$.messager.alert('提示', obj.msg);
									}
								}
							});
						}
					}, {
						text : '取消',
						handler : function() {
							dlg.dialog('close');
						}
					} ],
					onClose : function() {
						$(this).dialog('destroy');
					},
					onLoad : function() {
						if (rows[0].startDate != null && trim(rows[0].startDate) != "") {
							if (rows[0].startDate.length > 10) {
								var t = rows[0].startDate.substring(0, 10);
								rows[0].startDate = t;
							}
						}
						if (rows[0].endDate != null && trim(rows[0].endDate) != "") {
							if (rows[0].endDate.length > 10) {
								var t = rows[0].endDate.substring(0, 10);
								rows[0].endDate = t;
							}
						}
						$('#student_studentEdit_editResumeForm').form('load', rows[0]);
						$('#student_studentEdit_editResumeForm input[name=id]').val(rows[0].id);
					}
				});
			} else {
				$.messager.alert('提示', '一次只能修改一条数据！');
			}
		}

		function removeResume() {
			var rows = studentResumeDatagrid.datagrid('getChecked');
			var ids = [];
			if (rows.length > 0) {
				$.messager.confirm('确认', '确定要删除选择的数据吗？', function(r) {
					if (r) {
						for ( var i = 0; i < rows.length; i++) {
							ids.push(rows[i].id);
						}
						$.ajax({
							url : '${pageContext.request.contextPath}/resumeAction!removeResume.action',
							data : {
								ids : ids.join(',')
							},
							dataType : 'json',
							success : function(r) {
								studentResumeDatagrid.datagrid('load');
								studentResumeDatagrid.datagrid('unselectAll');
								$.messager.show({
									title : '提示',
									msg : r.msg,
								});
							}
						});
					}
				});
			} else {
				$.messager.show({
					title : '提示',
					msg : '请勾选要删除的记录！'
				});
			}
		}

		$('#student_studentEdit_identityTypeCombobox').combobox({
			valueField : 'cvalue',
			textField : 'cname',
			editable : false,
			onSelect : function(rec) {
				$('#student_studentEdit_editStudentOtherForm input[name=identityType]').val(rec.cvalue);
			}
		});
		$('#student_studentEdit_politicalStatusCombobox').combobox({
			valueField : 'cvalue',
			textField : 'cname',
			editable : false,
			onSelect : function(rec) {
				$('#student_studentEdit_editStudentOtherForm input[name=politicalStatus]').val(rec.cvalue);
			}
		});
		$('#student_studentEdit_bloodTypeCombobox').combobox({
			valueField : 'cvalue',
			textField : 'cname',
			editable : false,
			onSelect : function(rec) {
				$('#student_studentEdit_editStudentOtherForm input[name=bloodType]').val(rec.cvalue);
			}
		});

	});
</script>

<div id="tt" class="easyui-tabs" data-options="plain: true" style="width:850px;height:375px;margin:0;padding:0;">
	<div title="基本信息" style="padding:20px;">
		<form id="student_studentEdit_editGeneralForm" method="post">
			<table>
				<tr>
					<td style="text-align: right;">姓名：</td>
					<td><input name="studentName" readonly="readonly" /></td>
					<td style="text-align: right;">&nbsp;&nbsp;&nbsp;&nbsp;学号：</td>
					<td><input name="studentNo" readonly="readonly" /></td>
				</tr>
				<tr>
					<td style="text-align: right;">工作单位：</td>
					<td colspan="3"><input name="corporationName" class="easyui-validatebox" data-options="required:true,missingMessage:'必填项'" style="width:320px;" readonly="readonly" />&nbsp;
						<button type="button" onclick="openCorpDialog('generalAdd');">浏览</button></td>
				</tr>
				<tr>
					<td style="text-align: right;">性别：</td>
					<td><input type="radio" name="gender" value="01" checked="checked" />&nbsp;男 <input type="radio" name="gender" value="02" />&nbsp;女</td>
					<td style="text-align: right;">职称：</td>
					<td><input name="title" /></td>
				</tr>
				<tr>
					<td style="text-align: right;">职务：</td>
					<td><input name="position" /></td>
					<td style="text-align: right;">手机：</td>
					<td><input name="mobile" /></td>
				</tr>
				<tr>
					<td style="text-align: right;">电子邮件：</td>
					<td><input name="email" class="easyui-validatebox" data-options="validType:'email'" /></td>
					<td style="text-align: right;">QQ：</td>
					<td><input name="qq" /></td>
				</tr>
				<tr>
					<td style="text-align: right;">固话：</td>
					<td><input name="phone" /></td>
					<td style="text-align: right;">传真：</td>
					<td><input name="fax" /></td>
				</tr>
			</table>
			<table style="padding:10px;">
				<tr>
					<td colspan="3" style="width:320px;"></td>
					<td><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="saveStudent()">保存</a>
					</td>
				</tr>
			</table>
			<input name="id" type="hidden" />
			<input name="corporationId" type="hidden" />
		</form>
	</div>
	<div title="职业履历" style="padding:0;">
		<div id="student_studentEdit_resumeLayout" class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<table id="student_studentEdit_resumeDatagrid"></table>
			</div>
		</div>
	</div>
	<div title="个人爱好" style="padding:20px;">
		<form id="student_studentEdit_editHobbyForm" method="post">
			<table>
				<tr>
					<td style="text-align: right;">交流方式：</td>
					<td colspan="2"><textarea name="communication" style="width:240px;"></textarea></td>
					<td style="text-align: right;">&nbsp;&nbsp;&nbsp;&nbsp;着装配饰：</td>
					<td colspan="2"><textarea name="clothes" style="width:240px;"></textarea></td>
				</tr>
				<tr>
					<td style="text-align: right;">性格特征：</td>
					<td colspan="2"><textarea name="feature" style="width:240px;"></textarea></td>
					<td style="text-align: right;">&nbsp;&nbsp;&nbsp;&nbsp;娱乐方式：</td>
					<td colspan="2"><textarea name="pastime" style="width:240px;"></textarea></td>
				</tr>
				<tr>
					<td style="text-align: right;">饮食：</td>
					<td colspan="2"><textarea name="diet" style="width:240px;"></textarea></td>
					<td style="text-align: right;">&nbsp;&nbsp;&nbsp;&nbsp;住宿：</td>
					<td colspan="2"><textarea name="lodge" style="width:240px;"></textarea></td>
				</tr>
				<tr>
					<td style="text-align: right;">出行：</td>
					<td colspan="2"><textarea name="trip" style="width:240px;"></textarea></td>
					<td style="text-align: right;">&nbsp;&nbsp;&nbsp;&nbsp;其它爱好：</td>
					<td colspan="2"><textarea name="otherInterest" style="width:240px;"></textarea></td>
				</tr>
			</table>
			<table style="padding:10px;">
				<tr>
					<td style="width:500px;"></td>
					<td><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="addOrEditHobby()">保存</a>
					</td>
				</tr>
			</table>
			<input name="id" type="hidden" />
			<input name="studentId" type="hidden" />
		</form>
	</div>
	<div title="车辆信息" style="padding:0;">
		<div id="student_studentEdit_vehicleLayout" class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<table id="student_studentEdit_vehicleDatagrid"></table>
			</div>
		</div>
	</div>
	<div title="人际关系" style="padding:0;">
		<div id="student_studentEdit_relationshipLayout" class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<table id="student_studentEdit_relationshipDatagrid"></table>
			</div>
		</div>
	</div>
	<div title="家庭信息" style="padding:0;">
		<div id="student_studentEdit_familyLayout" class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<table id="student_studentEdit_familyDatagrid"></table>
			</div>
		</div>
	</div>
	<div title="教育信息" style="padding:0;">
		<div id="student_studentEdit_educationLayout" class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<table id="student_studentEdit_educationDatagrid"></table>
			</div>
		</div>
	</div>
	<div title="培训信息" style="padding:0;">
		<div id="student_studentEdit_trainingLayout" class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<table id="student_studentEdit_trainingDatagrid"></table>
			</div>
		</div>
	</div>
	<div title="个人相关" style="padding:20px;">
		<form id="student_studentEdit_editStudentOtherForm" method="post">
			<table>
				<tr>
					<td style="text-align: right;">证件类型：</td>
					<td><input id="student_studentEdit_identityTypeCombobox" name="identityTypeName" class="easyui-combobox" /></td>
					<td style="text-align: right;">&nbsp;</td>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td style="text-align: right;">&nbsp;&nbsp;证件号码：</td>
					<td><input name="identityNo" /></td>
					<td style="text-align: right;">&nbsp;&nbsp;政治面貌：</td>
					<td><input id="student_studentEdit_politicalStatusCombobox" name="politicalStatusName" class="easyui-combobox" /></td>
				</tr>
				<tr>
					<td style="text-align: right;">出生日期：</td>
					<td><input name="birthday" class="easyui-datebox" /></td>
					<td style="text-align: right;">&nbsp;&nbsp;民族：</td>
					<td><input name="nation" /></td>
				</tr>
				<tr>
					<td style="text-align: right;">出生地点：</td>
					<td colspan="3"><input name="birthplace" style="width:400px;" /></td>
				</tr>
				<tr>
					<td style="text-align: right;">家庭住址：</td>
					<td colspan="3"><input name="homeAddress" style="width:400px;" />&nbsp;</td>
				</tr>
				<tr>
					<td style="text-align: right;">邮政编码：</td>
					<td><input name="postcode" class="easyui-numberbox" maxlength="6" /></td>
					<td style="text-align: right;">血型：</td>
					<td><input id="student_studentEdit_bloodTypeCombobox" name="bloodTypeName" class="easyui-combobox" /></td>
				</tr>

			</table>
			<input name="id" type="hidden" />
			<input name="studentId" type="hidden" />
			<input name="identityType" type="hidden" />
			<input name="politicalStatus" type="hidden" />
			<input name="bloodType" type="hidden" />
			<table style="padding:20px;">
				<tr>
					<td style="width:350px;"></td>
					<td><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="addOrEditStudentOther()">保存</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>